package SPI;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: homechen
 * Date: 2024-03-24
 * Time: 15:06
 */
class Person implements Cloneable {
    private String name;
    private int age;
    public Person(String name, int age) {

        this.name = name;
        this.age = age;
    }
    // 这里是浅克隆
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
public class CloneExample {
    public static void main(String[] args) throws CloneNotSupportedException {
        Person person = new Person("tc", 20);
        Person clonePerson = (Person) person.clone();
        System.out.println(person == clonePerson);
    }
}
